<template>
  <div v-if="visible" class="shortcuts-overlay" @click="close">
    <div class="shortcuts-dialog" @click.stop>
      <div class="shortcuts-header">
        <h3>键盘快捷键</h3>
        <el-button type="text" icon="el-icon-close" @click="close" class="close-btn"></el-button>
      </div>
      <div class="shortcuts-content">
        <div class="shortcut-item">
          <div class="shortcut-key">P</div>
          <div class="shortcut-desc">全屏/取消全屏</div>
        </div>
        <div class="shortcut-item">
          <div class="shortcut-key">1</div>
          <div class="shortcut-desc">跳转到设备管理</div>
        </div>
        <div class="shortcut-item">
          <div class="shortcut-key">2</div>
          <div class="shortcut-desc">跳转到温度传感器</div>
        </div>
        <div class="shortcut-item">
          <div class="shortcut-key">3</div>
          <div class="shortcut-desc">跳转到压力传感器</div>
        </div>
        <div class="shortcut-item">
          <div class="shortcut-key">4</div>
          <div class="shortcut-desc">跳转到心率传感器</div>
        </div>
        <div class="shortcut-item">
          <div class="shortcut-key">5</div>
          <div class="shortcut-desc">跳转到传感器数据</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "ShortcutsHelp",
  props: {
    visible: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    close() {
      this.$emit('update:visible', false);
    }
  }
}
</script>

<style scoped lang="scss">
.shortcuts-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.shortcuts-dialog {
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  width: 90%;
  max-width: 500px;
  overflow: hidden;
  animation: fadeIn 0.3s ease;
}

.shortcuts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #f0f0f0;
  
  h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #303133;
  }
  
  .close-btn {
    color: #909399;
    font-size: 18px;
    
    &:hover {
      color: #606266;
    }
  }
}

.shortcuts-content {
  padding: 20px;
}

.shortcut-item {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  
  &:last-child {
    margin-bottom: 0;
  }
}

.shortcut-key {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 36px;
  height: 36px;
  background-color: #f5f7fa;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  margin-right: 16px;
  font-weight: 600;
  color: #606266;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.shortcut-desc {
  color: #606266;
  font-size: 14px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
</style>